package com.listeningframework.boot.codegen.context;

import org.apache.commons.lang3.StringUtils;

/**
 * Created by lixining on 2017/8/8.
 */
public class ProjectContext {
    /**
     * SRC路径
     */
    private String srcLocation;
    /**
     * Config路径相对SrcLocation
     */
    private String configLocation;

    /**
     * 工程包路径
     */
    private String projectPackage;
    /**
     * Controller包路径
     */
    private String webPackage;
    /**
     * Entity 包路径
     */
    private String entityPackage;
    /**
     * Service包路径
     */
    private String servicePackage;
    /**
     * Dao包路径
     */
    private String daoPackage;
    /**
     * Domain路径
     */
    private String domainPackage;
    /**
     * MyBatis脚本路径
     */
    private String mybatisLocation;

    public String getSrcLocation() {
        return srcLocation;
    }

    public void setSrcLocation(String srcLocation) {
        this.srcLocation = srcLocation;
    }

    public String getProjectPackage() {
        return StringUtils.isBlank(projectPackage) ? "com.listening.works" : projectPackage;
    }

    public void setProjectPackage(String projectPackage) {
        this.projectPackage = projectPackage;
    }

    public String getWebPackage() {
        return getProjectPackage() + "." + (StringUtils.isBlank(webPackage) ? "web" : webPackage);
    }

    public void setWebPackage(String webPackage) {
        this.webPackage = webPackage;
    }

    public String getEntityPackage() {
        return getProjectPackage() + "." + (StringUtils.isBlank(entityPackage) ? "entity" : entityPackage);
    }

    public void setEntityPackage(String entityPackage) {
        this.entityPackage = entityPackage;
    }

    public String getServicePackage() {
        return getProjectPackage() + "." + (StringUtils.isBlank(servicePackage) ? "service" : servicePackage);
    }

    public void setServicePackage(String servicePackage) {
        this.servicePackage = servicePackage;
    }

    public String getDaoPackage() {
        return getProjectPackage() + "." + (StringUtils.isBlank(daoPackage) ? "repository" : daoPackage);
    }

    public void setDaoPackage(String daoPackage) {
        this.daoPackage = daoPackage;
    }

    public String getDomainPackage() {
        return getProjectPackage() + "." + (StringUtils.isBlank(domainPackage) ? "domain" : domainPackage);
    }

    public void setDomainPackage(String domainPackage) {
        this.domainPackage = domainPackage;
    }

    public String getMybatisLocation() {
        return StringUtils.isBlank(mybatisLocation) ? "spring/mybatis/" : mybatisLocation;
    }

    public void setMybatisLocation(String mybatisLocation) {
        this.mybatisLocation = mybatisLocation;
    }

    public String getSrcJavaPath() {
        return getSrcLocation() + "main/java/";
    }

    public String getSrcResourcesPath() {
        return getSrcLocation() + "main/resources/";
    }

    public String getConfigLocation() {
        return configLocation;
    }

    public void setConfigLocation(String configLocation) {
        this.configLocation = configLocation;
    }
}
